/** 查询字典管理列表 */
export function listDictApi(query: DictRecord): Promise<ApiRowsRecord<DictRecord[]>> {
  return request({
    url: `system/dict/type/list`,
    method: 'get',
    params: query
  })
}

/** 查询字典管理详细 */
export function getDictApi(id: number): Promise<ApiDataRecord<DictRecord>> {
  return request({
    url: `system/dict/type/${id}`,
    method: 'get'
  })
}

/** 新增字典管理 */
export function addDictApi(data: DictRecord): Promise<ApiRecord> {
  return request({
    url: "system/dict/type",
    method: 'post',
    data: data
  })
}

/** 修改字典管理 */
export function updateDictApi(data: DictRecord): Promise<ApiRecord> {
  return request({
    url: "system/dict/type",
    method: 'put',
    data: data
  })
}

/** 删除字典管理 */
export function delDictApi(id: number[]): Promise<ApiRecord> {
  return request({
    url: `system/dict/type/${id}`,
    method: 'delete',
  })
}

/** 查询字典类型列表 */
export function listOptionselectApi(): Promise<ApiDataRecord<DictRecord[]>> {
  return request({
    url: '/system/dict/type/optionselect',
    method: 'get',
  })
}

/** 查询字典值列表 */
export function getDictsApi(dictType: string): Promise<ApiDataRecord<DictItemRecord[]>> {
  return request({
    url: `/system/dict/data/type/${dictType}`,
    method: 'get',
  })
}

// 刷新字典缓存
export function dictRefreshCacheApi(): Promise<ApiRecord> {
  return request({
    url: '/system/dict/type/refreshCache',
    method: 'delete'
  })
}